When we fail for some reason to open a stream to write the screenshot
to, we currently return `false` to the sender. That's not wrong, but
doesn't provide any hints on what caused the failure, so return the
underlying error instead.
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3618
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1589>
let stream = file.replace(null, false, Gio.FileCreateFlags.NONE, null);
return [stream, file];
} catch (e) {
- invocation.return_value(GLib.Variant.new('(bs)', [false, '']));
+ invocation.return_gerror(e);
return [null, null];
}
}
+ let err;
for (let file of this._resolveRelativeFilename(filename)) {
try {
let stream = file.create(Gio.FileCreateFlags.NONE, null);
return [stream, file];
} catch (e) {
+ err = e;
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS))
break;
}
}
- invocation.return_value(GLib.Variant.new('(bs)', [false, '']));
+ invocation.return_gerror(err);
return [null, null];
}